package lab02.Text11;

public class Square extends Rectangle {
    Square(double a, double b) {
        super(a, b);
    }
    //行为：新增加求对角线长的方法
    double c;
    public double getDiagonal() {
        c = Math.sqrt(a * a + b * b);
        return c;
    }
    public void printMyWay(){
        System.out.println("该正方形的长a="+a+"宽b="+b);
        System.out.println("该正方形的面积s="+getArea());
        System.out.println("该正方形的周长l="+getLength());
        System.out.println("该正方形的对角线d="+getDiagonal());
    }
}
